<?php
/**
 * JumpTo - A Download System for Content Pages. Work in Joomla 1.0.x & Joostina.
 * @author:      Лаборатория сайтов
 * @version:     1.3
 * @release:     2009.12.20
 * @package:     com_jumpto
 * @copyright:   (C) 2009 http://sitelab.net.ru
 * @license:     http://www.gnu.org/copyleft/gpl.html GNU/GPL
 *
 * Cоздан на базе Registered Downloads  (C) 2006 by St. John Johnson
 **/

#-Запрет прямого доступа-#
defined( '_VALID_MOS' ) or die();

if (file_exists( JPATH_BASE.'/components/com_jumpto/lang/' . $mosConfig_lang . '.php')) {
	include_once( JPATH_BASE.'/components/com_jumpto/lang/' . $mosConfig_lang . '.php' );
}else {
	include_once( JPATH_BASE.'/components/com_jumpto/lang/russian.php' );
}

$uid = (int)mosGetParam( $_REQUEST, 'uid', 0 );

if (is_integer(0 + $uid)) {

	$database = database::getInstance();

	$query = "SELECT id,url,reg FROM #__jumpto WHERE id=".$uid;
	$row = $database->setQuery( $query )->loadRow();
	if ($row != 0) {
		if ($row[2] ? $my->id <> 0:1) {
			$query = "UPDATE #__jumpto SET count=count+1 WHERE id=".$row[0];
			$database->setquery( $query )->query();
			if(headers_sent()) {
				echo "<script type='text/javascript'>location.href='".$row[1]."';</script>";
			}else {
				header("Location: ".$row[1]);
			}
		} else {
			echo "<script type='text/javascript'>window.alert('".JUMPTO_UP_FOR_REG."');window.history.go(-1);</script>";
		}
	} else {
		echo "<script type='text/javascript'>window.alert('".JUMPTO_WRONG_FILE_ID."');window.history.go(-1);</script>";
	}
} else {
	echo "<script type='text/javascript'>window.alert('".JUMPTO_WRONG_FILE_ID."');window.history.go(-1);</script>";
}